package testshop.db;

import java.sql.*;

/*
* 连接jdbc数据库
* */
public final class DbConn {

    static final String JDBC_DRIER = "com.mysql.jdbc.Driver";
    static final String DB_URL = "jdbc:mysql://localhost:3306/jx?useUnicode=true&characterEncoding=UTF-8";
    static final String USER = "admin";
    static final String PASSWORD = "admin";


    public static Connection getconn(){

        Connection conn = null;

        try{
            Class.forName(JDBC_DRIER);
            conn = DriverManager.getConnection(DB_URL,USER,PASSWORD);
        }catch (SQLException e){
            e.printStackTrace();
        }catch (ClassNotFoundException e){
            e.printStackTrace();
        }

        return conn;


    }




}
